(function(_,$){
	if(!_.Changer){
		return ;
	}
	_.Changer.addHandler({
		name : "input_colorpicker",
		selector : "input[changer*='colorpicker']",
		handler : function(objs , region){
			objs.each(function(i){
				var current = objs.eq(i);
				current.ColorPicker({
					onSubmit: function(hsb, hex, rgb, el) {
						$(el).val(hex);
						$(el).ColorPickerHide();
					},
					onBeforeShow: function () {
						$(this).ColorPickerSetColor(this.value);
					}
				}).bind('focus', function(){
					$(this).ColorPickerSetColor(this.value);
				}).attr("onremove","var id = $(this).data('colorpickerId');$('#'+id).remove();");
			});
		}
	});
})(jDreamer,jQuery);